const references = {
  ARCHUS_CRM_ACCESS: 1,
  STUDENT_UPDATE: 12,
  ARRANGEMENT_UPDATE: 16,
  ARRANGEMENT_VIEW: 19,
  ARRANGEMENT_EXPORT: 3,
  INVOICE_UPDATE: 17,
  CLASS_UPDATE: 5,
  CLASS_VIEW_EXPORT: 1,
  RECEIPT_VIEW_EXPORT: 5,
  PARENT_UPDATE: 9,
  COURSE_ELIGIBILITY_VIEW: 1,
  COURSE_UPDATE: 5,
  COURSE_VIEW_EXPORT: 2,
  REGISTRATION_UPDATE: 19,
  REFUND_UPDATE: 4,
  REFUND_VIEW_EXPORT: 4,
  INVOICE_VIEW_EXPORT: 3,
  STATEMENT_OF_ACCOUNT_VIEW_EXPORT: 1,
  LESSON_UPDATE: 12,
  LESSON_VIEW_EXPORT: 2,
  DELIVERY_UPDATE: 2,
  MATERIAL_UPDATE: 10,
  REGISTRATION_VIEW: 11,
  PARENT_VIEW: 9,
  STUDENT_VIEW: 11,
  DEPARTMENT_VIEW: 7,
  BRANCH_VIEW: 7,
  VENUE_VIEW: 7,
  ACADEMIC_LEVEL_VIEW: 7,
  ACADEMIC_YEAR_VIEW: 7,
  SCHOOL_VIEW: 7,
  GROUP_ASSIGNMENT_VIEW: 6,
  TERM_BILLING_DUE_DATE_VIEW: 4,
  HOLIDAY_VIEW: 6,
  REFERENCE_DATA_UPDATE: 5,
  WHATSAPP_ACCOUNT_VIEW: 5,
  REWARD_VIEW: 5,
  INTEGRATION_VIEW: 5,
  FEATURE_UPDATE: 2,
  COURSE_VIEW: 11,
  CLASS_VIEW: 6,
  LESSON_VIEW: 4,
  INVOICE_VIEW: 7,
  RECEIPT_VIEW: 5,
  REFUND_VIEW: 5,
  STATEMENT_OF_ACCOUNT_VIEW: 6,
  REPORT_ATTENDANCE_VIEW: 3,
  REPORT_INVOICE_VIEW: 3,
  REPORT_PAYMENT_VIEW: 4,
  REPORT_REVENUE_VIEW: 4,
  TASK_VIEW: 5,
  SYSTEM_USER_VIEW: 2,
  MATERIAL_VIEW: 5,
  DELIVERY_VIEW: 6,
  CAMPAIGN_VIEW: 6,
  PARENT_EXPORT: 1,
  STUDENT_EXPORT: 2,
  REFERENCE_DATA_VIEW: 2,
  FEATURE_VIEW: 1,
  CAMPAIGN_UPDATE: 2
};

const enumEnumPermissions = `enum EnumPermissions {
  /**
   * Access to the application.
   */
  ARCHUS_ACCESS = "archus:access",
  ARCHUS_ADMINISTRATION_ACCESS = "archus-administration:access",
  ARCHUS_CRM_ACCESS = "archus-crm:access",
  ARCHUS_ACADEMIC_ACCESS = "archus-academic:access",
  ARCHUS_CCC_ACCESS = "archus-ccc:access",
  ARCHUS_NOTES_ACCESS = "archus-notes:access",

  // Balance
  BALANCE_UPDATE = "balance:update",

  // Invoice
  INVOICE_VIEW = "invoice:view",
  INVOICE_VIEW_EXPORT = "invoice:view:export",
  INVOICE_UPDATE = "invoice:update",

  // Receipt
  RECEIPT_VIEW = "receipt:view",
  RECEIPT_VIEW_EXPORT = "receipt:view:export",

  // Refund
  REFUND_VIEW = "refund:view",
  REFUND_VIEW_EXPORT = "refund:view:export",
  REFUND_UPDATE = "refund:update",

  // StatementOfAccount
  STATEMENT_OF_ACCOUNT_VIEW = "statement-of-account:view",
  STATEMENT_OF_ACCOUNT_VIEW_EXPORT = "statement-of-account:view:export",

  // Payment
  PAYMENT_VIEW = "payment:view",
  PAYMENT_UPDATE = "payment:update",

  // Worksheet
  WORKSHEET_VIEW = "worksheet:view",
  WORKSHEET_VIEW_EXPORT = "worksheet:view:export",
  WORKSHEET_UPDATE = "worksheet:update",

  // course
  COURSE_VIEW = "course:view",
  COURSE_VIEW_EXPORT = "course:view:export",
  COURSE_UPDATE = "course:update",

  // class
  CLASS_VIEW = "class:view",
  CLASS_VIEW_EXPORT = "class:view:export",
  CLASS_UPDATE = "class:update",

  // Lesson
  LESSON_VIEW = "lesson:view",
  LESSON_VIEW_EXPORT = "lesson:view:export",
  LESSON_UPDATE = "lesson:update",

  // Topic
  TOPIC_CREATE = "topic:create",

  // Homework
  HOMEWORK_VIEW = "homework:view",
  HOMEWORK_UPDATE = "homework:update",

  // Exercise
  EXERCISE_VIEW = "exercise:view",
  EXERCISE_UPDATE = "exercise:update",

  // Collect
  COLLECT_VIEW = "collect:view",
  COLLECT_UPDATE = "collect:update",

  // Users
  SYSTEM_USER_VIEW = "system-user:view",
  SYSTEM_USER_VIEW_EXPORT = "system-user:view:export",
  SYSTEM_USER_UPDATE = "system-user:update",

  // Parent
  PARENT_VIEW = "parent:view",
  PARENT_EXPORT = "parent:view:export",
  PARENT_UPDATE = "parent:update",

  // Student
  STUDENT_VIEW = "student:view",
  STUDENT_EXPORT = "student:view:export",
  STUDENT_UPDATE = "student:update",

  // Enrollment
  ENROLLMENT_VIEW = "enrollment:view",

  // Attendance
  ATTENDANCE_VIEW = "attendance:view",
  ATTENDANCE_UPDATE = "attendance:update",

  // Registration
  REGISTRATION_VIEW = "registration:view",
  REGISTRATION_EXPORT = "registration:view:export",
  REGISTRATION_UPDATE = "registration:update",

  // Arrangement
  ARRANGEMENT_VIEW = "arrangement:view",
  ARRANGEMENT_EXPORT = "arrangement:view:export",
  ARRANGEMENT_UPDATE = "arrangement:update",

  // GroupAssignment
  GROUP_ASSIGNMENT_VIEW = "group-assignment:view",
  GROUP_ASSIGNMENT_UPDATE = "group-assignment:update",

  // Integrations
  INTEGRATION_VIEW = "integration:view",
  INTEGRATION_UPDATE = "integration:update",

  // Features
  FEATURE_VIEW = "feature:view",
  FEATURE_UPDATE = "feature:update",

  // TASK
  TASK_VIEW = "task:view",
  TASK_UPDATE = "task:update",

  // Whatsapp
  WHATSAPP_ACCOUNT_VIEW = "whatsapp-account:view",
  WHATSAPP_ACCOUNT_UPDATE = "whatsapp-account:update",

  WHATSAPP_MESSAGE_VIEW = "whatsapp-message:view",
  WHATSAPP_MESSAGE_UPDATE = "whatsapp-message:update",

  // Feedback
  FEEDBACK_VIEW = "feedback:view",
  FEEDBACK_UPDATE = "feedback:update",
}`;

const updatedEnum = enumEnumPermissions.replace(/(\w+ = "[^"]+",?)/g, (match, p1) => {
  const key = match.split(' ')[0];
  const referenceCount = references[key] || 0;
  return `${p1} // ${referenceCount}`; 
});

console.log(updatedEnum);
